
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>设备录入</title>
    <link type="text/css" rel="stylesheet" href="../../static/css/style.css" >
    <link type="text/css" rel="stylesheet" href="../../static/layui/css/layui.css">
    <style>
       .schoolDepartment{ display: flex;justify-content: space-between;width: 100%}
    </style>
</head>
<body>
<div id="RegistContainer" style="height: 950px">
    <br/><br/>
    <span><h1 style="color: white">设&nbsp;备&nbsp;系&nbsp;统&nbsp;录&nbsp;入</h1></span>
    <div id="purchasetForm" >
        <form action="" method="post" enctype="multipart/form-data">
            <div class="layui-form-item" >
                <br/><br/>
                <label class="layui-form-label">编&nbsp;&nbsp;&nbsp;&nbsp;号</label>
                <div class="layui-input-block">
                    <input type="text" id="nuo" required  lay-verify="required" placeholder="请输入编号" autocomplete="off" class="layui-input" style="width: 200px">
                </div>
            </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">名&nbsp;&nbsp;&nbsp;&nbsp;称</label>
                    <div class="layui-input-block">
                        <input type="text" id="name" required  lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input" style="width: 200px">
                    </div>
                </div>
            <div class="layui-form-item">
                <label class="layui-form-label">参&nbsp;&nbsp;&nbsp;&nbsp;数</label>
                <div class="layui-input-inline">
                    <input type="text" id="parameter" required lay-verify="required" placeholder="请输入设备编号" autocomplete="off" class="layui-input"style="width: 200px">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">价格</label>
                <div class="layui-input-inline">
                    <input type="text" id="price" required lay-verify="required" placeholder="请输入价格" autocomplete="off" class="layui-input"style="width: 200px">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">生产厂商</label>
                <div class="layui-input-inline">
                    <input type="text" id="birth" required lay-verify="required" placeholder="请输入厂商" autocomplete="off" class="layui-input"style="width: 200px">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">用途</label>
                <div class="layui-input-inline">
                    <input type="text" id="use" required lay-verify="required" placeholder="请输入用途" autocomplete="off" class="layui-input"style="width: 200px">
                </div>
                <div class="layui-input-block" style="float: left">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">存放地点</label>
                <div class="layui-input-inline">
                    <select id="place" lay-verify="required" style="height: 38px;width: 200px">
                        <option value="">请选择存放地点</option>
                        <option value="0">仓库1</option>
                        <option value="1">仓库2</option>
                        <option value="2">仓库3</option>
                    </select>
                </div>
                <div class="layui-input-block" style="float: left">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">领用人</label>
                <div class="layui-input-inline">
                    <input type="text" id="people" required lay-verify="required" placeholder="请输入领用人" autocomplete="off" class="layui-input"style="width: 200px">
                </div>
                <div class="layui-input-block" style="float: left">
                </div>
            </div>
            <div class="schoolDepartment">
                <div class="layui-form-item" style="display: flex;width: 49%">
                    <label class="layui-form-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;学&nbsp;校&nbsp;</label>
                    <div class="layui-input-inline">
                        <select name="school" id="school" style="height: 38px;width: 180px">
                            <option>请选择学校</option>
                        </select>
                    </div>
                    <div class="layui-input-block" style="float: left">
                    </div>
                </div>
                <div class="layui-form-item" style="display: flex;width: 49%">
                    <label class="layui-form-label" >院&nbsp;系</label>
                    <div  class="layui-input-inline">
                        <select name="department" id="department" style="height: 38px;width: 150px">
                            <option>请选择院系</option>
                        </select>
                    </div >
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">备&nbsp;&nbsp;&nbsp;&nbsp;注</label>
                <div class="layui-input-block">
                    <textarea id="remark" placeholder="请输入内容" class="layui-textarea" style="width: 350px"></textarea>
                </div>
            </div>
            <div class="schoolDepartment">
                <div class="layui-form-item"style="display:flex;width: 49%">
                    <label class="layui-form-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;购&nbsp;入&nbsp;日&nbsp;期</label>
                    <div class="layui-input-inline" >
                        <input type="text" id="buytime" required lay-verify="required" placeholder="请选择日期" autocomplete="off" class="layui-input" style="width: 150px">
                    </div>
                </div>
                <div class="layui-form-item" style="display:flex;width: 49%">
                    <label class="layui-form-label">&nbsp;生产日期</label>
                    <div class="layui-input-inline" >
                        <input type="text" id="birthday" required lay-verify="required" placeholder="请选择日期" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-form-item" style="display: flex;justify-content: space-between">
                <div class="layui-input-block" style="display: flex;max-width:49%">
                    <label class="layui-form-label">状&nbsp;态</label>
                    <select name="city" lay-verify="required" style="height: 38px;width: 150px;">
                        <option value="">请选择状态</option>
                        <option value="1">良好</option>
                        <option value="2">维修</option>
                        <!--          <option value="3"></option>-->
                    </select>
                    <div class="layui-input-block" style="display: flex;max-width:49%">
                     <button type="button" class="layui-btn" id="upload" style="width: 120px;">
                        <i class="layui-icon">&#xe67c;</i>上传图片
                    </button>
                    </div>

                </div></div>
            <input type="file" placeholder="11111">
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <br/>
                    <button class="layui-btn" lay-submit lay-filter="formDemo" style="width: 100px" >录入</button>
                    <button type="reset" class="layui-btn layui-btn-primary"style="width: 100px">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>


<div class="layui-footer" style="text-align: center">
    <p >©加文龙 吴可 何帅为 版权所有</p>
    <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;联系我们：13648078528</p>

</div>
<script src="../../script/jquery-1.7.2.js"></script>
<script src="../../static/layui/layui.js"></script>
<script>
    layui.use('laydate', function(){
        let laydate = layui.laydate;
        laydate.render({
            elem: '#buytime',//指定元素
            type:'Date'
        });
    });
    layui.use('laydate', function(){
        let laydate = layui.laydate;
        laydate.render({
            elem: '#birthday',//指定元素
            type:'Date'
        });
    });
    layui.use('upload', function(){
        var upload = layui.upload;

        //执行实例
        var uploadInst = upload.render({
            elem: '#upload' //绑定元素
            ,url: '/upload/' //上传接口
            ,done: function(res){
                //上传完毕回调
            }
            ,error: function(){
                //请求异常回调
            }
        });
    });

</script>
<script>
    var schools=['成都工业学院','电子科技大学'];
    var departments=[
        ['计算机工程学院','机械制造学院','通信学院'],
        ['马克思主义学院','药学学院'],
    ];
    window.onload=function(){
        var school=document.getElementById("school");
        var department=document.getElementById("department");
        //页面加载时添加省份数据
        for(i=0; i<schools.length; i++){
            school.innerHTML+="<option>"+schools[i]+"</option>";
        }
        //城市切换时change事件绑定
//省份下拉框change事件绑定
        school.onchange=function(){
            //添加新数据之前应该先去掉原本可能有的城市
            department.options.length=1;
            if(school.selectedIndex==0){
                //没有选中省份，那么文本框中清空内容
                addtxt.value="";
            }else{
                //选中省份，同时添加该省份的城市数据
                for(i=0; i<departments[school.selectedIndex-1].length; i++){
                    department.innerHTML+="<option>"+departments[school.selectedIndex-1][i]+"</option>";
                }
            }
        }

    }

</script>
</body>

</html>